package com.samphanie.ane.core.security.oauth2;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter;

/**
 * @Description:
 * @Author ZSY
 * @createTime 2021/3/12 11:18
 */
@Configuration
public class CustomTokenConverter extends DefaultAccessTokenConverter {

    public CustomTokenConverter(UserDetailsService userDetailsService) {
        DefaultUserAuthenticationConverter converter = new DefaultUserAuthenticationConverter();
        converter.setUserDetailsService(userDetailsService);
        super.setUserTokenConverter(converter);
    }

}
